package com.hnkywl.sts.quartz;

import com.hnkywl.sts.service.taskdeal.DoBgcgdSync;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: ccr
 * Date: 13-8-19
 * Time: 下午6:46
 * To change this template use File | Settings | File Templates.
 */
public class BgcgdSyncJob extends QuartzJobBean {
    // 定义日志
    private static Log log = LogFactory.getLog(PlanImprtJob.class);
    private DoBgcgdSync doBgcgdSync;
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        log.info("bgcgdSync 开始执行............");
        List<Map> bgcgd = doBgcgdSync.findBgcgd();
        if(!CollectionUtils.isEmpty(bgcgd)){
            for(Map item : bgcgd){
                doBgcgdSync.doBgcgdSync(item);
            }
        }
        log.info("bgcgdSync 执行结束............");
    }

    public DoBgcgdSync getDoBgcgdSync() {
        return doBgcgdSync;
    }

    public void setDoBgcgdSync(DoBgcgdSync doBgcgdSync) {
        this.doBgcgdSync = doBgcgdSync;
    }
}
